package day_2023_7_to_10;

/**
 * @author haomin
 * @date 2023/07/29 23:35
 **/
public class Day_7_29 {
    class Solution {
        public boolean findNumberIn2DArray(int[][] matrix, int target) {
            if (matrix.length == 0 || matrix[0].length == 0) return false;
            int i = 0, j = matrix[0].length-1;
            int l = 0, d = matrix.length-1;
            while(i <= d && j >= 0) {
                if (matrix[i][j] < target) i++;
                else if (matrix[i][j] > target) j--;
                else return true;
            }
            return false;
        }
    }
}